home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / src-server / wc_ScrolledW.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-04  |  4.7 KB  |  122 lines

  1. /* -*-C-*-
  2. ********************************************************************************
  3. *
  4. * File:         wc_ScrolledW.c
  5. * RCS:          $Header: wc_ScrolledW.c,v 1.3 91/03/14 03:15:11 mayer Exp $
  6. * Description:  XM_SCROLLED_WINDOW_WIDGET_CLASS
  7. * Author:       Niels Mayer, HPLabs
  8. * Created:      Sat Oct 28 04:38:40 1989
  9. * Modified:     Thu Oct  3 22:21:26 1991 (Niels Mayer) mayer@hplnpm
  10. * Language:     C
  11. * Package:      N/A
  12. * Status:       X11r5 contrib tape release
  13. *
  14. * WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  15. * XLISP version 2.1, Copyright (c) 1989, by David Betz.
  16. *
  17. * Permission to use, copy, modify, distribute, and sell this software and its
  18. * documentation for any purpose is hereby granted without fee, provided that
  19. * the above copyright notice appear in all copies and that both that
  20. * copyright notice and this permission notice appear in supporting
  21. * documentation, and that the name of Hewlett-Packard and David Betz not be
  22. * used in advertising or publicity pertaining to distribution of the software
  23. * without specific, written prior permission.  Hewlett-Packard and David Betz
  24. * make no representations about the suitability of this software for any
  25. * purpose. It is provided "as is" without express or implied warranty.
  26. *
  27. * HEWLETT-PACKARD AND DAVID BETZ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
  28. * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  29. * IN NO EVENT SHALL HEWLETT-PACKARD NOR DAVID BETZ BE LIABLE FOR ANY SPECIAL,
  30. * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  31. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  32. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  33. * PERFORMANCE OF THIS SOFTWARE.
  34. *
  35. * See ./winterp/COPYRIGHT for information on contacting the authors.
  36. * Please send modifications, improvements and bugfixes to mayer@hplabs.hp.com
  37. * Post XLISP-specific questions/information to the newsgroup comp.lang.lisp.x
  38. *
  39. ********************************************************************************
  40. */
  41. static char rcs_identity[] = "@(#)$Header: wc_ScrolledW.c,v 1.3 91/03/14 03:15:11 mayer Exp $";
  42.  
  43. #include <stdio.h>
  44. #include <Xm/Xm.h>
  45. #include <Xm/ScrolledW.h>
  46. #include "winterp.h"
  47. #include "user_prefs.h"
  48. #include "xlisp/xlisp.h"
  49. #include "w_funtab.h"
  50.  
  51. extern Widget Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(); /* w_classes.c */
  52.  
  53.  
  54. /******************************************************************************
  55.  * (send <ScrolledWin_Widget> :SET_AREAS <hscroll> <vscroll> <wregion>)
  56.  * ==> returns <ScrolledWin_Widget>....
  57.  * This method allows you to add or change the work region controlled by
  58.  * a scrolled window, and set the scrollbars for scrolled windows in which
  59.  * resource :XMN_SCROLLING_POLICY is set to :APPLICATION_DEFINED.
  60.  * <wregion> <hscroll> and  <vscroll> are all WIDGETOBJS. Use NIL
  61.  * if you don't want to set a particular parameter.
  62.  *
  63.  * void XmScrolledWindowSetAreas(sw, hscroll, vscroll, wregion)
  64.  *     XmScrolledWindowWidget sw;
  65.  *     Widget hscroll;
  66.  *     Widget vscroll;
  67.  *     Widget wregion;
  68.  ******************************************************************************/
  69. LVAL Xm_Scrolled_Window_Widget_Class_Method_SET_AREAS()
  70. {
  71.   LVAL self, widgetobj;
  72.   Widget widget_id, hscroll_id, vscroll_id, wregion_id;
  73.   int value;
  74.  
  75.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <self> */
  76.  
  77.   if (moreargs() && (*xlargv == NIL)) {    /* get <hscroll> */
  78.     nextarg();
  79.     hscroll_id = NULL;
  80.   }
  81.   else
  82.     hscroll_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&widgetobj);
  83.  
  84.   if (moreargs() && (*xlargv == NIL)) {    /* get <vscroll> */
  85.     nextarg();
  86.     vscroll_id = NULL;
  87.   }
  88.   else
  89.     vscroll_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&widgetobj);
  90.  
  91.   if (moreargs() && (*xlargv == NIL)) {    /* get <wregion> */
  92.     nextarg();
  93.     wregion_id = NULL;
  94.   }
  95.   else
  96.     wregion_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&widgetobj);
  97.  
  98.   xllastarg();
  99.  
  100.   XmScrolledWindowSetAreas(widget_id, hscroll_id, vscroll_id, wregion_id);
  101.   
  102.   return (self);
  103. }
  104.  
  105. /******************************************************************************
  106.  *
  107.  ******************************************************************************/
  108. Wc_ScrolledW_Init()
  109. {
  110.   LVAL o_XM_SCROLLED_WINDOW_WIDGET_CLASS;
  111.   extern LVAL Wcls_Create_Subclass_Of_WIDGET_CLASS(); /* w_classes.c */
  112.   extern      xladdmsg();    /* from xlobj.c */
  113.  
  114.   o_XM_SCROLLED_WINDOW_WIDGET_CLASS =
  115.     Wcls_Create_Subclass_Of_WIDGET_CLASS("XM_SCROLLED_WINDOW_WIDGET_CLASS",
  116.                      xmScrolledWindowWidgetClass);
  117.  
  118.   xladdmsg(o_XM_SCROLLED_WINDOW_WIDGET_CLASS, ":SET_AREAS",
  119.        FTAB_Xm_Scrolled_Window_Widget_Class_Method_SET_AREAS);
  120. }
  121.